/*
 * Java Card File Parser 
 * Based on openjcvm project 
 */
package org.naive.metawatch.converter.parser;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Field;

/**
 *
 * @author Andrew Butenko
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Parsed {

    Class<? extends Parseable> value();

    public class FieldParser {

        public static Parseable parse(Parsed p, ParseContext x, Field f) throws Exception {
            Parseable v = p.value().newInstance();
            v.parse(x);
            return v;
        }
    }
}
